package dao;

import entity.News;

public interface NewsDao {
    /**
     * 保存新闻信息的方法
     *
     * @param news
     */
    public void save(News news);

    public static NewsDao getInstance(String key) {
        switch (key) {
            case "mysql":
                return new NewsDaoMysqlImpl();
            case "oracle":
                return new NewsDaoOracleImpl();
            case "redis":
                return new NewsDaoRedisImpl();
            default:
                throw new RuntimeException("无效数据库类型:" + key + ",DAO获取失败!");
        }
    }

}
